package com.zdxlz.fcmp.common.mybatis.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @Description：工单信息表【产品类型】枚举类
 * @Author： aman
 * @Date： 2025/2/8 10:34
 */
@Getter
@AllArgsConstructor
public enum ProductTypeEnum {
    FREE_VERSION(1, "免费版"),
    BASIC_EDITION(2, "基础版"),
    ULTIMATE(3, "旗舰版"),
    ;
    @EnumValue
    private final Integer code;
    private final String name;

    public static ProductTypeEnum getByCode(Integer code) {
        for (ProductTypeEnum productTypeEnum : ProductTypeEnum.values()) {
            if (productTypeEnum.getCode() == code) {
                return productTypeEnum;
            }
        }
        return null;
    }

    @JsonValue
    public int getCode() {
        return code;
    }
}
